/*
 * SyncContactService.java
 * Author:  lixh
 * Create Date:  2015年9月6日
 * Copyright (c) 2015 miux.com. All Right Reserved.
 */
package com.yinhai.receiver;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;

import com.yinhai.service.ContactUserServiceImpl;

/**
 * SyncContactService (<类描述>)
 *
 * Author:lixh
 */
public class SyncContactService extends Service {
    private ContactUserServiceImpl contactUserService;
    private String phone;
    
    @Override
    public void onCreate() {
        super.onCreate();
        contactUserService = new ContactUserServiceImpl(this);
        
    }
    
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        phone = intent.getStringExtra("phone");
        new DataThread().start();
        Log.e("xxxxxxphonexxxxxxx", phone);
        return super.onStartCommand(intent, flags, startId);
    }
    
    /**
     * @param arg0
     * @return
     */
    @Override
    public IBinder onBind(Intent arg0) {
        
        return null;
    }
    
    public class DataThread extends Thread {
        
        @Override
        public void run() {
            super.run();
            
            Looper.prepare();
            contactUserService.initOnlineContactNew(phone);
            Looper.loop();
        }
        
    }
}
